//
//  DiscussTableViewCell1.m
//  Movie
//
//  Created by tengyang on 15/7/27.
//  Copyright (c) 2015年 tengyang. All rights reserved.
//


#import "common.h"
#import "UIImageView+WebCache.h"
@implementation DiscussTableViewCell1


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor=[UIColor redColor];
        
    }
    return self;
}

- (void)setModal:(DiscussModal *)modal
{
    _modal=modal;
    [self setNeedsLayout];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    _userImage=[[UIImageView alloc]initWithFrame:CGRectMake(0, 10, 40, 40)];
    
    [_userImage sd_setImageWithURL:[NSURL URLWithString:_modal.userImage]];
    [self.contentView addSubview:_userImage];
    
    
    _nickname=[[UILabel alloc]initWithFrame:CGRectMake(45, 10, 300, 20)];
    _nickname.text=_modal.nickname;
    [self.contentView addSubview:_nickname];
    
    
    _rating=[[UILabel alloc]initWithFrame:CGRectMake(kWidth-40, 10, 40, 20)];
    _rating.text=_modal.rating;
    [self.contentView addSubview:_rating];
    
    
    CGFloat maxLabelWidth=kWidth-140;
    CGSize contenSize = [_modal.content sizeWithFont:[UIFont systemFontOfSize:18] constrainedToSize:CGSizeMake(maxLabelWidth, 1000)];
    
    _content=[[UILabel alloc]initWithFrame:CGRectMake(45, 35, contenSize.width , contenSize.height)];
    _content.text=_modal.content;
    [self.contentView addSubview:_content];
    
    
    
    
}




- (void)awakeFromNib {
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
